package com.witframework.web.tag.portal;


import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.BodyContent;
import javax.servlet.jsp.tagext.BodyTagSupport;

public class Portlet extends BodyTagSupport
{
  private static final String DEFHEIGHT = "25";
  private String body = null;
  private String bodyData = null;
  private String column = null;
  private String border = "0";
  private String borderColor = "#0000FF";
  private String bodyColor = "#FFFFFF";
  private String title = null;
  private String titleColor = "#00FF00";
  private String titleHeight = "20";
  private String maximize = null;
  private String target = null;

  public void setBody(String paramString)
  {
    this.body = paramString;
  }

  public String getBody()
  {
    return this.body;
  }

  public void setColumn(String paramString)
  {
    this.column = paramString;
  }

  public String getColumn()
  {
    return this.column;
  }

  public void setBorder(String paramString)
  {
    this.border = paramString;
  }

  public String getBorder()
  {
    return this.border;
  }

  public void setBorderColor(String paramString)
  {
    this.borderColor = paramString;
  }

  public String getBorderColor()
  {
    return this.borderColor;
  }

  public void setBodyColor(String paramString)
  {
    this.bodyColor = paramString;
  }

  public String getBodyColor()
  {
    return this.bodyColor;
  }

  public void setTitle(String paramString)
  {
    this.title = paramString;
  }

  public String getTitle()
  {
    return this.title;
  }

  public void setTitleColor(String paramString)
  {
    this.titleColor = paramString;
  }

  public String getTitleColor()
  {
    return this.titleColor;
  }

  public void setTitleHeight(String paramString)
  {
    this.titleHeight = paramString;
  }

  public String getTitleHeight()
  {
    return this.titleHeight;
  }

  public void setMaximize(String paramString)
  {
    this.maximize = paramString;
  }

  public String getMaximize()
  {
    return this.maximize;
  }

  public void setTarget(String paramString)
  {
    this.target = paramString;
  }

  public String getTarget()
  {
    return this.target;
  }

  public int doAfterBody()
    throws JspException
  {
    BodyContent localBodyContent = getBodyContent();
    if (localBodyContent != null)
    {
      this.bodyData = localBodyContent.getString();
      localBodyContent.clearBody();
    }
    return 0;
  }

  public int doEndTag()
    throws JspException
  {
    Portal localPortal = (Portal)findAncestorWithClass(this, Portal.class);
    if (localPortal == null)
      throw new JspException("Could not find ancestor Portal for Portlet tag");
    PortletBean localportletBean = new PortletBean();
    if (this.body != null)
    {
      localportletBean.setBodyFile(this.body);
      this.bodyData = null;
    }
    if (this.bodyData != null)
      localportletBean.setBodyData(this.bodyData);
    if (this.column != null)
      localportletBean.setColumn(this.column);
    if (this.border != null)
      localportletBean.setBorder(this.border);
    if (this.borderColor != null)
      localportletBean.setBorderColor(this.borderColor);
    if (this.bodyColor != null)
      localportletBean.setBodyColor(this.bodyColor);
    if (this.title != null)
      localportletBean.setTitle(this.title);
    if (this.titleColor != null)
      localportletBean.setTitleColor(this.titleColor);
    if (this.titleHeight != null)
      localportletBean.setTitleHeight(this.titleHeight);
    if (this.maximize != null)
      localportletBean.setMaximize(this.maximize);
    if (this.target != null)
      localportletBean.setTarget(this.target);
    localPortal.addPortlet(localportletBean);
    dropData();
    return 6;
  }

  public void release()
  {
    dropData();
  }

  private void dropData()
  {
    this.body = null;
    this.bodyData = null;
    this.column = null;
    this.border = "0";
    this.borderColor = "#FFFFFF";
    this.bodyColor = "#FFFFFF";
    this.title = null;
    this.titleColor = "#00FF00";
    this.titleHeight = "20";
    this.maximize = null;
    this.target = null;
  }
}
